<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>创建管理员（保密）</title>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.pin.js"></script>

<link href="css/bootstrap.min.css" rel="stylesheet">

<style type="text/css">
	h2{
		color:#FF6600;
		width:200px;
		margin:30px auto;
		
	}
	#fm{
		width:500px;
		height:200px;
		margin:30px auto;
		text-align:left;
	}
	
	#rd{
		width:300px;
		margin:auto 5px;
	}
	.s1{
		color:#F00;
		display: none;
	}
	.s1 span{
		color:#009900;
	}

</style>
<script>
	$(function(){
		var flat;
		$('input[name="account"]').blur(function(){
			if($(this).val().length < 1 && $(this).val()==''){
				$(this).next().text('请填写帐号！').show();
				flat = false;
			} else {
				$(this).next().text('').append('<span>输入正确！</span>').show();
				flat = true;
			}
		});
		$('input[name="password"]').blur(function(){
			if($(this).val().length < 1 && $(this).val()==''){
				$(this).next().text('请填写密码！').show();
				flat = false;
			} else {
				$(this).next().text('').append('<span>输入正确！</span>').show();
				flat = true;
			}
		});
		$('input[name="name"]').blur(function(){
			if($(this).val().length < 1 && $(this).val()==''){
				$(this).next().text('请填写昵称！').show();
				flat = false;
			} else if ($(this).val().length < 2){
				$(this).next().text('昵称至少有2个字！').show();
				flat = false;
			} else {
				$(this).next().text('').append('<span>输入正确！</span>').show();
				flat = true;
			}
		});
		
		$('input[name="email"]').blur(function(){
			if($(this).val().length < 1 && $(this).val()==''){
				$(this).next().text('请填写邮箱').show();
				flat = false;
			} else {
				$(this).next().text('').append('<span>输入正确！</span>').show();
				flat = true;
			}
		});
		$("#frm").on('submit', function(event) {
			$('#account').blur();
			$('#password').blur();
			$('#name').blur();
			$('#email').blur();
			console.log(flat);
			 if(flat) {
			 	return true;
			 } else {
			 	return false;
			 }
		});
	});
</script>
</head>
<body>
	<div class="container">
	<div class="row clearfix">
		<div class="col-sm-4 col-md-4 column">
		</div>
		<div class="col-sm-4 col-md-4 column">
			<h3 class="text-center text-info">
				请填写管理员信息
			</h3>
			
			<form  id="frm" action="adminLogic.php" method="post" class="form-horizontal" role="form">
				<input type="hidden" name="method" value="create" />
				<div class="form-group">
					 <label class="col-sm-3 col-md-3 control-label">帐号</label>
					 <div class="col-md-9 col-sm-9">
						 <input type="text" class="form-control" name="account" id="account" placeholder="请输入帐号" />
						 <span class='s1'> </span>
					 </div>
				</div>
				<div class="form-group">
					 <label class="col-sm-3 col-md-3 control-label">密码</label>
					 <div class="col-md-9 col-sm-9">
						 <input type="password" class="form-control" name="password" id="password" placeholder="请输入密码"/>
						 <span class='s1'> </span>
					 </div>
				</div>
				<div class="form-group">
					 <label class="col-sm-3 col-md-3 control-label">昵称</label>
					 <div class="col-sm-9 col-md-9 ">
						 <input type="text" class="form-control" name="name" id="name" placeholder="请输入昵称"/>
						 <span class='s1'> </span>
					 </div>
				</div>
				<div class="form-group">
					 <label class="col-sm-3 col-md-3 control-label">Email</label>
					 <div class="col-sm-9 col-md-9">
						 <input type="email" class="form-control" name="email" id="email" placeholder="请输入电子邮箱地址"/>
						 <span class='s1'> </span>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-1 col-md-1"></div>
					<div class="col-sm-5 col-md-5">
						<button type="submit" class="col-sm-3 btn btn-block btn-success">提交</button>
					</div>
					<div class="col-sm-5 col-md-5">
						<button type="reset" class="col-sm-3 btn btn-block btn-warning">重置</button>
					</div>
				</div>
			</form>
		</div>
		<div class="col-sm-4 col-md-2 column">
		</div>
		<div class="col-sm-4 col-md-2 column">
			 <ul class="nav nav-stacked nav-pills ">
				<li>
					 <a href="index.html">  留言板首页</a>
				</li>
				<li class="active">
					 <a href="adminCreate.html">  创建管理员</a>
				</li>
			</ul>
		</div>
	</div>
</div>
</body>
</html>